package com.fxu.tpl.enums;

import com.fxu.framework.core.enums.BaseEnum;
import lombok.AllArgsConstructor;

/***
 * <p>yuye</p>
 * 字段表：[column]的数据实体枚举类
 * @author fangxu
 * @version 2022-03-10
 ***/
@AllArgsConstructor
public enum ColumnQueryTypeEnum implements BaseEnum<Integer, String> {
    A(1, "普通"),
    B(2, "模糊"),
    C(3, "后模糊"),
    D(4, "范围不含边界"),
    E(5, "范围含边界"),
    ;

    Integer code;
    String desc;

    @Override
    public Integer code() {
        return code;
    }

    @Override
    public String desc() {
        return desc;
    }

    public static String desc(Integer code) {
        ColumnQueryTypeEnum ret = find(code);
        return ret == null ? null : ret.desc;
    }

    public static ColumnQueryTypeEnum find(Integer code) {
        return code == null ? null : BaseEnum.findOne(values(), v -> v.code.equals(code));
    }
}